package com.app.view_controller;

import java.sql.Time;
import java.util.Calendar;

import com.app.alarm.R;
import com.app.util.ApplicationMediator;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.ObjectAnimator;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.os.Bundle;
import android.util.Log;
import android.view.animation.AnimationUtils;
import android.widget.TimePicker;

@SuppressWarnings("unused")
public class TimeDialog extends DialogFragment implements OnTimeSetListener {
	private static final String TAG = "TIMEDIALOG";

	private static final boolean DEBUG = true;

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		Bundle b = getArguments();
		if (b == null) {
			Calendar cal = Calendar.getInstance();
			int h = cal.get(Calendar.HOUR);
			int m = cal.get(Calendar.MINUTE);
			return new TimePickerDialog(getActivity(), this, h, m, true);
		}
		android.text.format.Time t = new android.text.format.Time();
		t.set(b.getLong("ciao"));
		return new TimePickerDialog(getActivity(), this, t.hour, t.minute, true);
	}

	@Override
	public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
		ApplicationMediator.getInstance().sendMessageWithAttachedData(ContentActivity.RECEIVE_TIME_FROM_TIME_PICKER,
				hourOfDay, minute);
	}
}
